package ocean.chinacraft.common.world.item.tool.base;

import ocean.chinacraft.common.ModItems;
import net.minecraft.item.IItemTier;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyValue;

import javax.annotation.Nonnull;
import java.util.function.Supplier;

/**
 * 锤子
 *
 * @author zhang
 * @since 2021/11/19
 */
public enum ModHammerTier implements IItemTier {

    /**
     * 石锤子
     */
    STONE_HAMMER(1, 240, 1, 6f, 10, () -> Ingredient.of(ModItems.STONE_HAMMER.get())),

    /**
     * 铁锤子
     */
    IRON_HAMMER(2, 475, 1, 7f, 10, () -> Ingredient.of(ModItems.IRON_HAMMER.get())),

    /**
     * 青铜锤子
     */
    BRONZE_HAMMER(2, 475, 1, 7f, 10, () -> Ingredient.of(ModItems.BRONZE_HAMMER.get())),

    /**
     * 钻石锤子
     */
    DIAMOND_HAMMER(3, 2096, 1, 8f, 10, () -> Ingredient.of(ModItems.DIAMOND_HAMMER.get()));;


    private final int level;
    private final int maxUses;
    private final float speed;
    private final float attackDamageBonus;
    private final int enchantmentValue;
    private final LazyValue<Ingredient> repairIngredient;

    ModHammerTier(int level, int maxUses, float speed, float attackDamageBonus, int enchantmentValue,
                  Supplier<Ingredient> repairIngredient) {
        this.level = level;
        this.maxUses = maxUses;
        this.speed = speed;
        this.attackDamageBonus = attackDamageBonus;
        this.enchantmentValue = enchantmentValue;
        this.repairIngredient = new LazyValue<>(repairIngredient);
    }

    @Override
    public int getUses() {
        return maxUses;
    }

    @Override
    public float getSpeed() {
        return speed;
    }

    @Override
    public float getAttackDamageBonus() {
        return attackDamageBonus;
    }

    @Override
    public int getLevel() {
        return level;
    }

    @Override
    public int getEnchantmentValue() {
        return enchantmentValue;
    }

    @Nonnull
    @Override
    public Ingredient getRepairIngredient() {
        return repairIngredient.get();
    }
}
